<?php

require __DIR__.'/../../../vendor/autoload.php';

use Gateway\app\h5mno\H5mnoInitRequest;
use Gateway\CommUtil;
use Gateway\ESAliyunGateway;
use Gateway\Log;

/**
 * 获取认证Url
 *   参考文档：https://esandinfo.yuque.com/books/share/36b5f381-12de-4fbd-8b93-429653ca36e9?#
 *   服务器开通地址：https://market.aliyun.com/products/57126001/cmapi00046908.html?spm=5176.shop.result.20.6b7c28d87JsmuD&innerSource=search#sku=yuncode4090800001
 *   管理控制台地址：https://openali.esandcloud.com
 **/

$appCode = "TODO";// TODO 替换成你自己的appcode, 获取APPCODE  可参考 https://esandinfo.yuque.com/yv6e1k/ulp2ub/fs2mm48opwox3xc4?singleDoc#
//实例化网关对象
$gateway = new ESAliyunGateway($appCode);
//构造请求报文
$request = new H5mnoInitRequest();
$request->bizId = CommUtil::getTimeUUID();
$request->phoneNumber = "13588995478";
$request->returnUrl = "http://www.baidu.com";
//向网关发起请求
$rspMsg = $gateway->sendToGateWay(H5mnoInitRequest::$ALIYUN_URL,$request->toJsonStr());
if($rspMsg==null||strlen($rspMsg)==0){
    Log::ERROR("服务器返回内容为空");
    return;
}
Log::DEBUG("服务器返回内容为:".$rspMsg);
